﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.DALFactory;
using KPIS.GERP.GHRMS.MODEL;

namespace KPIS.GERP.GHRMS.BLL
{
    public class MasBloodGroupBLL : IMasBloodGroupBLL
    {
        private static readonly IMasBloodGroupDAL dal = DataAccess.CreateMasterBloodGroups();

        public IList<MasBloodGroupInfo> ListBloodGroups(string Sequence)
        {
            int Seq = Sequence.Length > 0 ? Int32.Parse(Sequence) : 0;
            return dal.ListBloodGroups(new MasBloodGroupInfo(Seq));
        }
        public void Insert(string Name, string NameEng, string Remarks, int CreatedBy)
        {
            try
            {
                dal.Insert(new MasBloodGroupInfo(0, Name, NameEng, Remarks, "", CreatedBy, 0));
            }
            catch 
            {
                throw new Exception("");
            }
        }
        public void Update(int Sequence, string Name, string NameEng, string Remarks, int UpdatedBy)
        {
            try
            {
                dal.Update(new MasBloodGroupInfo(Sequence, Name, NameEng, Remarks, "", 0, UpdatedBy));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Delete(int Sequence, int UpdatedBy)
        {
            try
            {
                dal.Delete(Sequence, UpdatedBy);
            }
            catch
            {
                throw new Exception("");
            }
        }
    }
}
